from LeetCoder import *


class Solution:
    def isWinner(self, player1: List[int], player2: List[int]) -> int:
        n = len(player1)
        d1 = [0] * n
        d2 = [0] * n
        for i, v in enumerate(player1):
            d1[i] = player1[i]
            if (i > 1 and (player1[i - 1] == 10 or player1[i-2] == 10)) or (i > 0 and player1[i-1] == 10):
                d1[i] = d1[i] * 2
        for i, v in enumerate(player2):
            d2[i] = player2[i]
            if (i > 1 and (player2[i - 1] == 10 or player2[i-2] == 10)) or (i > 0 and player2[i-1] == 10):
                d2[i] = d2[i] * 2
        print(d1)
        print(d2)
        s1, s2 = sum(d1), sum(d2)
        print(s1, s2)
        if s1 == s2:
            return 0
        return 1 if s1 > s2 else 2


s = Solution()
print(s.isWinner(player1=[10, 2, 2, 3], player2=[3, 8, 4, 5]))
print(s.isWinner(player1=[4, 10, 7, 9], player2=[6, 5, 2, 3]))
print(s.isWinner(player1=[3, 5, 7, 6], player2=[8, 10, 10, 2]))
print(s.isWinner(player1=[2, 3], player2=[4, 1]))
